package com.firefightingiot_data.data.web.web;

import cn.hutool.json.JSONObject;
import com.firefightingiot_data.data.common.base.BaseController;
import com.firefightingiot_data.data.support.annotaion.Action;
import com.firefightingiot_data.data.support.annotaion.At;
import com.firefightingiot_data.data.support.model.RespEntity;
import com.firefightingiot_data.data.web.model.DeviceAlarmLog;
import com.firefightingiot_data.data.web.service.AlarmService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import java.text.ParseException;

/**
 * @Author: YangYu
 * @ClassName: AlarmController
 * @Date: Created in 15:09 2022/4/21
 * @Description: 报警数据
 */
@Action
@RequestMapping(value="alarmInfo")
public class AlarmController extends BaseController {

    @Resource
    public AlarmService alarmService;

    /**
     * @Author YangYu
     * @Description 报警数据添加
     * @Date Created in 15:10 2022/4/21
     * @Param [jsonParam]
     */

    @At(value = "add", method = RequestMethod.POST)
    public RespEntity add(@RequestBody(required = false) JSONObject jsonParam) throws ParseException, InterruptedException {
        return alarmService.add(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 消防批量处置一天的数据
     * @Date Created in 13:46 2022/10/8
     * @Param [jsonParam]
     */

    @At(value = "batchFileHandle", method = RequestMethod.POST)
    public void test(@RequestBody(required = false) JSONObject jsonParam) throws  InterruptedException {
        alarmService.batchFileHandle(jsonParam);
    }
}
